package com.atguigu.mock.entity;

import com.atguigu.common.base.entity.AutoIdBase;
import com.atguigu.common.comment.Comment;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.Entity;
import javax.persistence.OneToOne;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Entity
@Getter
@Setter
@NoArgsConstructor
@Comment("授信表")
public class Credit extends AutoIdBase {

    @Comment("关联授信申请")
    @OneToOne(optional = false)
    private CreditFacility creditFacility;

    @Comment("授信状态：1.新建 2.已占用 3.已制作合同 4.已取消")
    private int status;

    @Comment("授信金额")
    private BigDecimal creditAmount;

    @Comment("授信占用时间")
    private LocalDateTime creditOccupyTime;

    @Comment("合同制作时间")
    private LocalDateTime contractProduceTime;

    @Comment("取消时间")
    private LocalDateTime cancelTime;

    @Comment("关联合同")
    @OneToOne
    private Contract contract;

    public Credit(LocalDateTime createTime, CreditFacility creditFacility, BigDecimal creditAmount) {
        super(createTime);
        this.creditFacility = creditFacility;
        this.creditAmount = creditAmount;
    }
}
